package com.example.yaxin.service.impl;

import com.example.yaxin.config.MailUserConfig;
import com.example.yaxin.entity.Weather;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


@Service
public class ScheduleService {

    @Autowired
    private MailService mailService;

    @Autowired
    private MailUserConfig mailUserConfig;

    public void send(Weather weather) {
        String text = String.format("今天是%s, 天气%s, 最高温度%d, 最低温度%d",
                weather.getDate(),
                weather.getWeather(),
                weather.getMaxTemperature(),
                weather.getMinTemperature());
        mailService.sendSimpleMail(mailUserConfig, text);
    }

}
